/****************************************************************************
 * Copyright (c) 2024 Qualcomm Technologies International, Ltd.
 ***************************************************************************/

/**
 * \defgroup   basic_passthrough
 * \file       task_mgr_wrapper.h
 * \ingroup    capabilities
 *
 * Basic passthrough operator private header file. <br>
 *
 */


#ifndef TASK_MGR_WRAPPER_H
#define TASK_MGR_WRAPPER_H

#include "../../components/sched_oxygen/sched_oxygen.h"

/**
 * Enumerations holding the number of sub-tasks indices
*/
typedef enum SUB_TASKS
{
    SUB_TASK_0 = 0,
    SUB_TASK_1 = 1,
    SUB_TASK_2 = 2,
    SUB_TASK_MAX
} SUB_TASKS;


/**
 * \brief Handles the message of the sub task 0 .
 *
 * \param[in]      msg_data          Pointer to a pointer to the OPERATOR_DATA of the operator.
 *                                   The type is void ** as this is a generic scheduler message
 *                                   handler.
 */
void task_mgr_task_handler0(void **msg_data);

/**
 * \brief Handles the message of the sub task 1.
 *
 * \param[in]      msg_data          Pointer to a pointer to the OPERATOR_DATA of the operator.
 *                                   The type is void ** as this is a generic scheduler message
 *                                   handler.
 */
void task_mgr_task_handler1(void **msg_data);

/**
 * \brief Handles the message of the sub task 2.
 *
 * \param[in]      msg_data          Pointer to a pointer to the OPERATOR_DATA of the operator.
 *                                   The type is void ** as this is a generic scheduler message
 *                                   handler.
 */
void task_mgr_task_handler2(void **msg_data);

/**
 * \brief Handles the background interrupt of the sub task 0.
 *
 * \param[in]      msg_data          Pointer to a pointer to the OPERATOR_DATA of the operator.
 *                                   The type is void ** as this is a generic background interrupt
 *                                   handler.
 */
void task_mgr_background_handler0(void **msg_data);

/**
 * \brief Handles the background interrupt of the sub task 1.
 *
 * \param[in]      msg_data          Pointer to a pointer to the OPERATOR_DATA of the operator.
 *                                   The type is void ** as this is a generic background interrupt
 *                                   handler.
 */
void task_mgr_background_handler1(void **msg_data);

/**
 * \brief Handles the background interrupt of the sub task 2.
 *
 * \param[in]      msg_data          Pointer to a pointer to the OPERATOR_DATA of the operator.
 *                                   The type is void ** as this is a generic background interrupt
 *                                   handler.
 */
void task_mgr_background_handler2(void **msg_data);

extern void (*task_handler_func_list[SUB_TASK_MAX]) (void**);

#define MAX_NUM_OF_SUBTASK_BUFFERS 8

typedef struct SUBTASK_CONTEXT
{
    unsigned *in_linear_buff[MAX_NUM_OF_SUBTASK_BUFFERS];
    int result;
} SUBTASK_CONTEXT;

/**
 * \brief Basic pass through timer task which gets kicked at a particular rate.
 *        The timer task have highest priority.
 * 
 * \param[in] msg             Pointer to the operator instance data.
*/
void basic_passthrough_timer_task(void *msg);

/**
 * \brief Creates a new task and/or bg int with the given parameters,
 * initialises the new task and returns the task id.
 * This is wrapper where the background and message handlers would
 * be picked accordingly from the list. Currently maximum of 3 subtasks(0,1 and 2)
 * would be created.
 *
 * \param[in]     task_priority  Priority of the new task
 * \param[in]     task_data      Task-specific data (see below)
 * \param[in]     count          Holds sub task index
 * 
 * \return        task_id        The task id of the newly created 
 *                               sub - task
 */ 
taskid task_mgr_create_task(PRIORITY task_priority,
                            void *task_data,
                            SUB_TASKS count);
#endif



